package com.examsystem.util;

import com.examsystem.dao.AnswerMapper;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;


/**
 * @author 86134
 */
public class CollectionSort {
    @Resource
    private  AnswerMapper answerMapper;

    public int num(int studentId,int paperId) {
        List<Integer> list = answerMapper.selectPsQ(studentId, paperId);
        int i = 0;
        //将集合的元素值大小排序【里面的值只有1 和 0】
        Collections.sort(list);
        int num1 = list.get(0);
        int num2 = list.get(list.size() - 1);
        if (num1 == num2 && num1 == 1) {
            i = answerMapper.updateUserPaperAnalysis(paperId);
        }
        return i;
    }
}
